<template>
  <div class="seeBox">
    <a-form :form="form">
      <a-row :gutter="24">
        <a-col :span="6">
          <a-form-model-item label="职位名称">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.name"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="公司名称">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.companyName"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="工作城市">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.requestCity"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="学历要求">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.requestResume"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="招聘类型">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.requestType"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="所属行业">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.category"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="职位类型">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.type"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="发布性质">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.publishType"
            />
          </a-form-model-item>
        </a-col>

        <a-col :span="6">
          <a-form-model-item label="年薪范围">
            <a-input
              v-if="show"
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.salaryMin"
            />
            <a-input
              v-else
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
               v-model="salary"
            />
           
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="状态">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.status"
            />
          </a-form-model-item>
        </a-col>

        <a-col :span="6">
          <a-form-model-item label="审批状态">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.approvalStatus"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="审批人">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.approvedBy"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="审批时间">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.approvalTime"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="申请人">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.createdBy"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="申请时间">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.createdAt"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="如何投递">
            <a-input
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.targetEmail"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="6">
          <a-form-model-item label="职位亮点">
            <a-textarea
              disabled
              allow-clear
              :auto-size="{ minRows: 1, maxRows: 3 }"
              v-model="details.highLight"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="图片">
            <a-upload
              :action="baseUrl + '/fileUpload/uploadImage'"
              :headers="headers"
              :disabled="true"
              list-type="picture-card"
              :file-list="fileList"
              accept=".jpg,.png"
            >
              <div v-if="fileList.length < 1">
                <a-icon type="plus" />
                <div class="ant-upload-text">上传</div>
              </div>
            </a-upload>
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="详细描述">
            <Editorbar
              ref="editor"
              :disabled="true"
              v-model="details.detail"
              style="width: 100%"
            ></Editorbar>
          </a-form-model-item>
        </a-col>
      </a-row>
    </a-form>
    <div class="footBtn" style="margin-bottom: 20px">
      <a-button
        type="primary"
        @click="$router.push('/business')"
        style="margin-right: 24px"
      >
        <a-icon type="rollback" />返回</a-button
      >
    </div>
  </div>
</template>

<script>
import { getAction, putAction, postAction } from "../../http/manage";
import Editorbar from "../../components/WangEditor";
export default {
  components: {
    Editorbar,
  },
  data() {
    return {
      baseUrl: baseUrl,
      headers: {
        accessToken: sessionStorage.getItem("accessToken"),
      },
      fileList: [],
      id: this.$route.query.id,
      answer: "213",
      question: "22",
      form: this.$form.createForm(this),
      search: "/job/jobsGetById/",
      details: {},
      show: false,
      salary:"面议",
    };
  },

  mounted() {
    this.getdata();
    this.$refs.editor.disableEditor();
  },
  methods: {
    getdata() {
      getAction(this.search + this.id)
        .then((res) => {
          this.details = res.data.data;
          console.log(res.data.data);
          this.details.salaryMin =
            this.details.salaryMin + "-" + this.details.salaryMax + "万/年";
          //   this.question = res.data.data.question;
          //   this.answer = res.data.data.answer;
          let show = res.data.data.salaryMin;
          console.log(show);
          if (show == '0-0万/年') {
            this.show = false;
            console.log(this.show);
          }else{
            this.show = true;
          }

          if (
            res.data.data.detailImages !== [] ||
            res.data.data.detailImages != [] ||
            res.data.data.detailImages != null
          ) {
            // this.fileList = [
            //   {
            //     url: res.data.data.detailImages,
            //     status: "done",
            //     name: res.data.data.detailImages,
            //     uid: 1,
            //   },
            // ];
            for (let i = 0; i < res.data.data.detailImages.length; i++) {
              let arr = res.data.data.detailImages[i];
              this.fileList.push({
                url: arr,
                status: "done",
                name: arr,
                uid: i,
              });
              //   this.carouselImg.push(arr);
              // (this.carouselImg);
            }
          }
        })
        .catch(() => {});
    },
  },
};
</script>

<style>
.seeBox {
  background-color: #fff;
  padding: 24px 24px 8px;
  border-radius: 4px;
  box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.12);
}
</style>